import 'package:flutter/material.dart';

main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(primaryColor: Colors.teal, cardColor: Colors.orange),
      debugShowCheckedModeBanner: false,
      home: HYHomePage(),
    );
  }
}

class HYHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Flutter Demo'),
      ),
      body: HYHomeContent(),
      backgroundColor: Colors.white,
      floatingActionButton: FloatingActionButton(
          child: Icon(
            Icons.add,
//            color: Colors.orange,
          ),
          backgroundColor: Colors.teal,
          onPressed: () {
            print('FloatingActionButton click');
          }),
      floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
    );
  }
}

class HYHomeContent extends StatefulWidget {
  @override
  _HYHomeContentState createState() => _HYHomeContentState();
}

class _HYHomeContentState extends State<HYHomeContent> {
  @override
  Widget build(BuildContext context) {
    return ContainerDemo();
  }
}

class ContainerDemo extends StatelessWidget {
  const ContainerDemo({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
//      color: Colors.teal,
      width: 200,
      height: 200,
//      alignment: Alignment(0, 0),
      padding: EdgeInsets.all(20),
      margin: EdgeInsets.all(10),
      child: Icon(
        Icons.pets,
        size: 50,
        color: Colors.white,
      ),
//      transform: Matrix4.rotationZ(50),
//      transform: Matrix4.skew(100, 100),
      decoration: BoxDecoration(
          color: Colors.teal,
          border: Border.all(width: 5, color: Colors.pink),
          borderRadius: BorderRadius.circular(100),
          boxShadow: [
            BoxShadow(
                color: Colors.orange,
                offset: Offset(10, 10),
                spreadRadius: 5,
                blurRadius: 10),
            BoxShadow(
                color: Colors.blue,
                offset: Offset(-10, -10),
                spreadRadius: 5,
                blurRadius: 10)
          ]),
    );
  }
}

class PaddingDemo extends StatelessWidget {
  const PaddingDemo({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Padding(
//          padding: const EdgeInsets.all(8.0),
//          padding: EdgeInsets.symmetric(horizontal: 10),
//          padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
          padding: EdgeInsets.only(bottom: 10, top: 10),
          child: Text(
            '你好啊',
            style: TextStyle(fontSize: 30, backgroundColor: Colors.teal),
          ),
        ),
        Text(
          '你好啊',
          style: TextStyle(fontSize: 30, backgroundColor: Colors.teal),
        ),
        Text(
          '你好啊',
          style: TextStyle(fontSize: 30, backgroundColor: Colors.teal),
        ),
      ],
    );
  }
}

class AlignDemo extends StatelessWidget {
  const AlignDemo({
    Key key,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    //    return Center(child: Icon(Icons.pets));
    return Align(
      child: Icon(
        Icons.pets,
        size: 50,
      ),
      widthFactor: 10,
      heightFactor: 10,
      alignment: Alignment(1, 1),
    );
  }
}
